--- interact_link: content/code-examples/demo-3-axis.ipynb kernel_name: python3 kernel_path: content/code-examples has_widgets: false title: |- Code Example pagenum: 2 prev_page: url: /abstract.html next_page: url: suffix: .ipynb search: demo axis code example using gropt naxis parameter set comment: "***PROGRAMMATICALLY GENERATED, DO NOT EDIT. SEE ORIGINAL FILES IN /content***" ---
Code Example
import os

os.chdir("../python/")

import build_gropt
build_gropt.build_gropt()
import gropt

from helper_utils import *
from interactive_plots import plot_waveform_interactive
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
from IPython.core.display import display, HTML
init_notebook_mode(connected = True)
config={'showLink': False, 'displayModeBar': False}
from timeit import default_timer as timer

%matplotlib inline
Building GrOpt . . .

Demo with 3 axis

Code example of using GrOpt with the "Naxis" parameter set to 3.

params = {}
params['mode'] = 'free'
params['gmax']  = 0.05
params['smax']  = 50.0
params['moment_params']  = [[0, 0, 0, -1, -1, 11.74, 1.0e-3]]
params['moment_params'].append([1, 0, 0, -1, -1, -11.74, 1.0e-3])
params['moment_params'].append([2, 0, 0, -1, -1, 11.74, 1.0e-3])
params['TE']  = 1.0
params['dt']  = 20e-6
params['Naxis'] = 3

G, dd = gropt.gropt(params, verbose=1)

fig = plot_waveform_interactive(G, params, eddy_lines=[50], width=585, height=430)
plot(fig, filename = 'fig.html', config = config)
display(HTML('fig.html'))
params = {}
params['mode'] = 'free'
params['gmax']  = 0.08
params['smax']  = 200.0
params['moment_params']  = [[0, 0, 0, -1, -1, 11.74, 1.0e-3]]
params['moment_params'].append([1, 0, 0, -1, -1, -11.74, 1.0e-3])
params['moment_params'].append([2, 0, 0, -1, -1, 11.74, 1.0e-3])
params['TE']  = 0.675
params['dt']  = 10e-6
params['Naxis'] = 3
params['pns_thresh'] = 1.0

G, dd = gropt.gropt(params, verbose=1)

fig = plot_waveform_interactive(G, params, width=585, height=430)
plot(fig, filename = 'fig.html', config = config)
display(HTML('fig.html'))